package ru.pashkan.emulator.controller;

import org.springframework.stereotype.Component;
import ru.pashkan.emulator.controller.threads.DefaultThreadFactory;
import ru.pashkan.emulator.controller.threads.RegistratorsControllerThread;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

@Component
public class RegistratorsController implements Controller{

    private ScheduledExecutorService service;

    @Override
    public void init() {
//        service = Executors.newSingleThreadScheduledExecutor();

        service = Executors.newScheduledThreadPool(2, new DefaultThreadFactory());
//        for (int i = 0; i < 5; i++) {
            RegistratorsControllerThread registratorsControllerThread = new RegistratorsControllerThread();



            service.scheduleWithFixedDelay(registratorsControllerThread, 1, 2, TimeUnit.SECONDS);
//        }


    }
}
